<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>找零工</title>
    <link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
    <style>
        .aui-list {
            background-image: none;
        }

        .aui-list .aui-list-item {
            background-image: -webkit-linear-gradient(90deg, #F0F0F0, #F0F0F0 50%, transparent 50%);
            padding: 0.5rem 0 0.5rem 0.75rem;
        }

        .aui-list .aui-list-item .aui-list-item-media img {
            border: 1px solid #ECECEC;
            border-radius: 100%;
            width: 3.5rem;
            height: 3.5rem;
        }

        .aui-list .aui-list-item .list_info {
            display: flex;
        }

        .aui-list .aui-list-item .list_info .list_text {
            display: flex;
            flex-direction: column;
            width: 100%;
            height: 100%;
            justify-content: space-between;
            align-items: flex-start;
            border-right: 1px solid #F0F0F0;
            margin-right: .75rem;
        }

        .aui-list .aui-list-item .list_info img {
            width: 2.5rem;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="aui-content">
            <ul class="aui-list aui-media-list">
                <li class="aui-list-item" v-for="data in listData" @click="detail(data.work_id)">
                    <div class="aui-media-list-item-inner">
                        <div class="aui-list-item-media">
                            <img :src="data.headimgurl">
                        </div>
                        <div class="aui-list-item-inner list_info">
                            <div class="list_text">
                                <div>{{data.title}}</div>
                                <p>{{data.create_time}}</p>
                            </div>
                            <div>
                                <img src="../../../image/icon/dianhua.png" alt="" @click.stop="call(data.contact_phone)">
                            </div>
                        </div>

                    </div>
                </li>
            </ul>
        </div>
    </div>
</body>
<script src="../../../script/api.js" charset="utf-8"></script>
<script src="../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    var stateBarH = '';
    apiready = function() {
        api.parseTapmode();

        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            userRegion: {},
            listData: [],
            pages: 1,
            title: '',
        },
        methods: {
            init() {
                this.userRegion = get_local('user_region');
                this.page();
                this.getListData();
            },
            getListData() {
                var self = this;
                _ajax(Config.api.ShortGetLists, {
                    longitude: self.userRegion.lon,
                    latitude: self.userRegion.lat,
                    pages: self.pages,
                    title: self.title
                }, function(res) {
                    if (res.code === 200) {
                        if (res.data.length === 0) {
                            $toast('数据已加载完毕');
                            self.pages = -1;
                        } else {
                            self.listData = self.listData.concat(res.data);
                        }
                    }
                });
            },
            page() {
                // 下拉刷新
                var self = this;
                push_down(function() {
                    //下拉刷新恢复
                    push_down_over();

                    self.pages = 1;
                    self.listData = [];
                    self.getListData();
                });

                //上拉加载
                push_up(function() {
                    if (self.pages === -1) {
                        $toast('数据已加载完毕');
                    } else {
                        ++self.pages;
                        self.getListData();
                    }
                });
            },
            detail(id) {
                open_w('odd_job_detail_win', './odd_job_detail_win.html', {
                    id: id
                });
            },
            call(phone) {
                api.call({
                    type: 'tel_prompt',
                    number: phone
                });
            }
        }
    });

    function search(cont) {
        vm.title = cont;
        vm.pages = 1;
        vm.listData = [];
        vm.getListData();
    }
</script>

</html>
